import Vue from 'vue'
import routers from 'vue-router'
/**
 * 重写路由的push方法
 * 避免发生崩溃
 */
const routerPush = routers.prototype.push
routers.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

//登记页面 file:///E:/gitproject/0web/webtest/1vueTest/src/components/HelloWorld.vue
import wecome from '../components/HelloWorld.vue';
import header from '../pages/util-header/header.vue'
import center from '../pages/util-header/center.vue'

import newheader from '../pages/home/newheader.vue'
import newFooter from '../pages/home/newFooter.vue'
import home from '../pages/home/home.vue'
import jingxuan from '../pages/jingxuan/jingxuan.vue'
import login from '../pages/login/login.vue'
import designers from '../pages/designers/designers.vue'
import information from '../pages/information/information.vue'
import contactUS from '../pages/contactUS/contactUS.vue'
import test from '../pages/test/test.vue'

Vue.use(routers)

export default new routers({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
		//  错误路径 重定向 
      path: '*',
      redirect: {
        name: 'home'
      }
    },
    {
      path: '/',
      redirect: {
        name: 'home'
      }
    },
    {
      path: '/wecome',
      name: 'wecome',
      component: wecome
    },
    {
      path: '/header',
      name: 'header',
      component: header
    },
    {
      path: '/center',
      name: 'center',
      component: center
    },
    {
      path: '/newheader',
      name: 'newheader',
      component: newheader
    },
    {
      path: '/newFooter',
      name: 'newFooter',
      component: newFooter
    },
    {
      path: '/home',
      name: 'home',
      component: home
    },
    {
      path: '/jingxuan',
      name: 'jingxuan',
      component: jingxuan
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/designers',
      name: 'designers',
      component: designers
    },
    {
      path: '/information',
      name: 'information',
      component: information
    },
    {
      path: '/contactUS',
      name: 'contactUS',
      component: contactUS
    },
    {
      path: '/test',
      name: 'test',
      component: test
    },
  ]
})
 